
function mainController($scope, $http, $routeParams){
	
	var pagenum = $routeParams.pagenum-1+1;
	
	$http.get("reponse_all_asc.json").then(function(response){
		var userinfo = response.data;
		
		$scope.userinfo = userinfo;
		
	},function(){});
	
	$http.get("pages.json").then(function(response){
		var maxpage = response.data.maxpage-1;
		var page = response.data.pagelist;
		
		if(pagenum<=maxpage){
			page[pagenum].activer = "active";
		}
		$scope.pagelist = page;
		
		$scope.prepage = pagenum-1<0 ?pagenum:pagenum-1;
		$scope.nextpage = pagenum+1 >maxpage?pagenum:pagenum+1;
		
	},function(){});
	setMenuActive(0);
}

function playerQuery($scope, $http, $routeParams) {
	$scope.id = $routeParams.playerId;
	/**
	 * 
	 * "id":"100",
	"username":"张三",
	"examtype":"java",
	"tel":"12345678912",
	"completetime":"2018-05-16",
	"score":"60",
	 */
	$http.get("stude.json").then(function(response){
		console.log(response.data);
		var len = response.data.length;
		for (var i = 0; i < len; i++) {
			if( response.data[i].id ==$scope.id ) {
				$scope.username = response.data[i].username;
				$scope.examtype = response.data[i].examtype;
				$scope.tel = response.data[i].tel;
				$scope.completetime = response.data[i].completetime;
				$scope.score = response.data[i].score;
				$scope.subject = response.data[i].subject;
				for (var i = 0; i < $scope.subject.length; i++) {
					$scope.subject[i].aqus = new Array();
					switch($scope.subject[i].type){
						case "single":
							$scope.subject[i].type = "单选题";
							$scope.subject[i].aqus.push({t:"A",q:$scope.subject[i].a});
							$scope.subject[i].aqus.push({t:"B",q:$scope.subject[i].b});
							$scope.subject[i].aqus.push({t:"C",q:$scope.subject[i].c});
							$scope.subject[i].aqus.push({t:"D",q:$scope.subject[i].d});
							break;
						case "multiple":
							$scope.subject[i].type = "多选题";
							$scope.subject[i].aqus.push({t:"A",q:$scope.subject[i].a});
							$scope.subject[i].aqus.push({t:"B",q:$scope.subject[i].b});
							$scope.subject[i].aqus.push({t:"C",q:$scope.subject[i].c});
							$scope.subject[i].aqus.push({t:"D",q:$scope.subject[i].d});
							break;
						case "Checking":
							$scope.subject[i].type = "判断题";
							$scope.subject[i].ac = $scope.subject[i].ac=="a"?"对":"错";
							break;
						default:
							break;
					}
					
					$scope.subject[i].result = $scope.subject[i].result=="y"?"glyphicon-ok":"glyphicon-remove";
				}
				break;
			}
		}
	},function(){
		
	});
	
}



function queryStudy($scope, $http, $routeParams){
	var searchStudy = $routeParams.searchStudy;
	// alert("查找的信息为:"+searchStudy);
/*	$http.post("vel",{name:"tim"},function(response){
		console.log(response);
	});*/
	$http.get("reponse_all_asc.json").then(function(response){
		$scope.userinfo = response.data;
	},function(){});
	setMenuActive(1);
}
